//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_worldboundscheck.sqf"
#include "x_setup.sqf"

__TRACE_1("","_this");
private "_pos";
_pos = _this;
if (count _pos == 0) exitWith {
	_pos;
};
if (_pos select 0 < 0) then {_pos set [0, 300]};
if (_pos select 1 < 0) then {_pos set [1, 300]};
if (_pos select 0 > (GVAR(island_x_max) - 2)) then {_pos set [0, GVAR(island_x_max) - 300]};
if (_pos select 1 > (GVAR(island_y_max) - 2)) then {_pos set [1, GVAR(island_y_max) - 300]};
__TRACE_1("","_pos");
_pos